load mcoord_10runs_2.mat;
Nf=size(mcoord,2);
Nr=size(mcoord,1);
tf=30; %(min)
dt=tf/Nf;
msd=[];t=[];mstd=[];
for j=1:Nf
    sd_j=[];
    for k=1:Nr
        i=1;
        while (i+j)<=Nf
            dx=mcoord(k,i+j,1)-mcoord(k,i,1);
            dy=mcoord(k,i+j,2)-mcoord(k,i,2);
            sd_j=[sd_j (dx^2 + dy^2)];
            i=i+1;
        end
    end
    %hist(sd_j,0:0.01:max(sd_j));
    %size(sd_j)
    msd=[msd mean(sd_j)];
    mstd=[mstd std(sd_j)];
    t=[t dt*j/60];
end
figure(110);
plot(t,msd);
hold on;
errorbar(t,msd,mstd);
xlabel('Time, (hr)','fontsize',20);
ylabel('$$\langle \Delta X^2 \rangle$$, (micron)','interpreter','latex','fontsize',20);
title(['MSD for Cdc42T geom center for ' num2str(tf) ' hr simulation'],'fontsize',20);
        